package io.renren.modules.quickService.service.impl;

import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.quickService.dao.OrderOperationDao;
import io.renren.modules.quickService.entity.OrderOperationEntity;
import io.renren.modules.quickService.service.OrderOperationService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("orderOperationService")
public class OrderOperationServiceImpl extends ServiceImpl<OrderOperationDao, OrderOperationEntity> implements OrderOperationService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<OrderOperationEntity> page = this.selectPage(
                new Query<OrderOperationEntity>(params).getPage(),
                new EntityWrapper<OrderOperationEntity>()
                        .like(params.get("key") != null, "order_id", params.get("key").toString(), SqlLike.DEFAULT)
        );
        return new PageUtils(page);
    }

    @Override
    public Long insertSelective(OrderOperationEntity operation) {
        return baseMapper.insertSelective(operation);
    }
}
